<template>
  <Layout :name="'今日值班'">

    <div class="duty-header">
      <div class="duty-header-item">
        <div class="top">值班局长</div>
        <div class="bottom">姓名:&nbsp;</div>
      </div>
      
      <div class="duty-header-split"></div>

      <div class="duty-header-item">
        <div class="top">值班主任</div>
        <div class="bottom">姓名:&nbsp;</div>
      </div>
    </div>

    <div class="duty-body">
      <div class="duty-body-item" v-for="item of dutyData" :key="item.id">
        <img class="duty-body-item-img" :src="avatar" alt="avatar">
        <div class="duty-body-item-name">{{ item.name }}</div>
        <div class="duty-body-item-depart">{{ item.departName }}</div>
      </div>
    </div>

  </Layout>
</template>

<script lang="ts" setup>
  import { ref, onMounted } from "vue";
  import Layout from '../layout.vue';
  import { getDutyData } from "@/api/pageApi";
  const avatar = new URL('@/assets/img/screen/avatar.png', import.meta.url).href;
  const dutyData = ref([]);
  onMounted(() => {
    getDutyData().then((res: any) => {
      console.log('今日值班数据');
      console.log(res);
      dutyData.value = res.data;
    })
  })
</script>

<style lang="less" scoped>
  .duty-header {
    width: 94%;
    display: flex;
    margin: 0 3px 0 auto;
    justify-content: space-between;
    .duty-header-item {
      flex: 1;
      background-image: url('@/assets/img/screen/dutyLeader.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      .top {
        height: 20px;
        color: #fff;
        text-indent: 8px;
        font-size: 14px;
        box-sizing: border-box;
        padding-top: 2px;
      }
      .bottom {
        height: 34px;
        color: #fff;
        font-size: 14px;
        text-indent: 8px;
        box-sizing: border-box;
        padding-top: 4px;
      }
    }
    .duty-header-split {
      width: 1px;
      margin: 0 12px;
      background-color: #487CA2;
    }
  }
  .duty-body {
    margin-top: 12px;
    height: 156px;
    overflow: auto;
    .duty-body-item {
      width: 92%;
      display: flex;
      height: 42px;
      margin: 0 0 10px 6%;
      align-items: center;
      justify-content: space-between;
      background-image: url('@/assets/img/screen/duty.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      .duty-body-item-img {
        width: 44px;
        height: 100%;
      }
      .duty-body-item-name {
        color: #fff;
        font-size: 14px;
      }
      .duty-body-item-depart {
        color: #fff;
        font-size: 14px;
      }
    }
  }
</style>